<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="(item, index) in swiperList" :key="index">
      <img :src="item.imgSrc" alt="" />
    </van-swipe-item>
  </van-swipe>
</template>

<script setup lang="ts">
import axios from 'axios'
import { onMounted, ref } from 'vue'

interface Swiper {
  link: string,
  imgSrc: string
}

onMounted(async () => {
  const { data } = await axios({
    url: '/swiperList',
    method: 'GET'
  })
  swiperList.value = data.result
})

const swiperList = ref<Swiper[]>([])
</script>

<style scoped>
.my-swipe {
  img {
    width: 100%;
  }
}
</style>